package com.xiaoniu.forum.web.controller.app;

import com.xiaoniu.forum.common.utils.PageUtils;
import com.xiaoniu.forum.common.utils.R;
import com.xiaoniu.forum.service.TabbarItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/app/tabbarItem")
public class AppTabbarItemController {
    @Autowired
    private TabbarItemService tabbarItemService;

    /**
     * 根据标签id查询所有标签子项
     * @param tabbarId
     * @return
     */
    @RequestMapping("/listByTabbarId/{tabbarId}")
    public R list(@PathVariable("tabbarId") String tabbarId){
        Map<String, Object> map = new HashMap<>();
        map.put("tabbarId",tabbarId);
        PageUtils pageUtils = tabbarItemService.queryPage(map);
        return R.ok().put("data",pageUtils.getList());
    }

}
